package java8_23.market;

import java.util.Scanner;
import java.util.function.Supplier;

/**
 * @author oldliu
 * @since 1.0
 */
public class TestSuperMarket {
    public static void main(String[] args) {
        SuperMarket sp=new SuperMarket();
        sp.name="北京华联";
        Scanner in=new Scanner(System.in);

        int choice=0;
        while (true){
            System.out.println("1:新会员，2：查看，3：涨积分，4：兑换，6: 找到积分最多的会员,9：退出");
            choice=in.nextInt();
            if(choice==1){
                Vip v=new Vip();//！！！！！！！！每次加入的都是新会员对象
                System.out.println("请输入会员的卡号，姓名，手机号，和初始积分：");
                v.cardNo=in.next();
                v.name=in.next();
                v.telephone=in.next();
                v.integal=in.nextInt();

                boolean f=sp.add(v);
            }else if(choice==2){
                sp.showInfo();
            }else if(choice==3){
                System.out.println("请输入会员号：");
                String card=in.next();
                System.out.println("涨多少分：");
                int zhang=in.nextInt();

                boolean increase=sp.inc(card,zhang);
                System.out.println(increase?"涨分成功":"失败，没有账号对应的会员");
            } else if(choice==6){
               Vip vmax=sp.findMax();
               if(vmax==null){
                   System.out.println("没有会员");
                   continue;
               }
                System.out.println("积分最多的会员信息如下：");
               vmax.show();
            }
            else if(choice==9){
                return;
            }
        }
    }
}
